import time
import numpy as np
from RA_Cal import ReflectArray_cal_FFT, Para_RA, MASK_rp, Costfunction, csvtest
import random

if __name__ == '__main__':
    Code_bestsofar = csvtest.Read_csv_inrows(r"GAnew_code_0.csv", range(int(952*1)))[0, :]
    print(np.shape(Code_bestsofar))
    Costfunction_400 = Costfunction.Costfunction_tt(400)
    # popu_rand = [random.randint(0, 1) for _ in range(len(Code_bestsofar))]

    # st = time.time()
    # print(Costfunction_400.CostFunction(0, Code_bestsofar))
    # print("cf time: ", time.time()-st)

    print("")
    print(Costfunction_400.CostFunction(0, Code_bestsofar))
    print("")
    print(Costfunction_400.CostFunction_View(0, Code_bestsofar))
    print("")